package myky.com.doctorapp.api;


import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import io.reactivex.Observable;
import myky.com.doctorapp.entity.AuthorListEntity;
import myky.com.doctorapp.entity.ConsultDetailsEntity;
import myky.com.doctorapp.entity.FeedBackEntity;
import myky.com.doctorapp.entity.MyDoctorEntity;
import myky.com.doctorapp.entity.PersionInfoEntity;
import myky.com.doctorapp.entity.PreRequestEntuty;
import myky.com.doctorapp.entity.DiseaseEntity;
import myky.com.doctorapp.entity.FollowDoctorEntity;
import myky.com.doctorapp.entity.FollowRecordEntity;
import myky.com.doctorapp.entity.FollowUploadEntity;
import myky.com.doctorapp.entity.LongRangeListEntity;
import myky.com.doctorapp.entity.RemoteDetailsEntity;
import myky.com.doctorapp.entity.MyConsultEntity;
import myky.com.doctorapp.entity.SearchHistoryItem;
import myky.com.doctorapp.entity.SimpleReponseEntity;
import myky.com.doctorapp.entity.UserEntity;
import myky.com.doctorapp.entity.RecordEntity;
import myky.com.doctorapp.entity.LoginSuccessEntity;
import myky.com.doctorapp.entity.NewConsultListBean;
import myky.com.doctorapp.entity.VersionEntity;
import myky.com.doctorapp.entity.BannerEntity;
import myky.com.doctorapp.entity.CaseCountsEntity;
import myky.com.doctorapp.entity.HealthEntity;
import myky.com.doctorapp.entity.NewCaseListEntity;
import myky.com.doctorapp.entity.RecDoctorListEntity;
import myky.com.doctorapp.entity.TagListEntity;
import myky.com.doctorapp.entity.LogoutEntity;
import myky.com.doctorapp.entity.SmsCodeEntity;
import myky.com.doctorapp.entity.RemoteAutoFillEntity;
import myky.com.doctorapp.entity.RemoteListEntity;
import myky.com.doctorapp.entity.RemoteRepeatEntity;
import myky.com.doctorapp.base.BaseEntity;
import myky.com.doctorapp.entity.AreaWrapperEntity;
import myky.com.doctorapp.entity.ChooseDisesTypeEntity;
import myky.com.doctorapp.entity.DepatmentAndAreaEntity;
import myky.com.doctorapp.entity.DepatmentWrapperEntity;
import myky.com.doctorapp.entity.DoctorEntity;
import myky.com.doctorapp.entity.DoctorTeamEntity;
import myky.com.doctorapp.entity.DoctorWrapperEntity;
import myky.com.doctorapp.entity.HealthRecordEntity;
import myky.com.doctorapp.entity.TeamEntity;
import myky.com.doctorapp.entity.LastConsultEntity;
import okhttp3.MultipartBody;
import okhttp3.RequestBody;
import okhttp3.ResponseBody;
import retrofit2.http.Body;
import retrofit2.http.FieldMap;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.Headers;
import retrofit2.http.Multipart;
import retrofit2.http.POST;
import retrofit2.http.Part;
import retrofit2.http.Path;
import retrofit2.http.QueryMap;
import retrofit2.http.Url;

/**
 * @author xiangyao
 */

public interface Apistore {

    /**
     * 账号密码登录
     *
     * @return
     */
    @Headers({"Content-Type: application/json", "Accept: application/json"})
    @GET("cas/cu/appLogin")
    Observable<BaseEntity<LoginSuccessEntity.PayLoadBean>> loginApi();

    /**
     * 推出登录
     *
     * @return
     */

    @GET("cas/cu/appLogin/logout")
    Observable<BaseEntity<LogoutEntity.PayLoadBean>> logoutApi();

    /**
     * 手机验证码登录
     *
     * @return
     */
    @GET("cas/cu/quickLogin")
    Observable<BaseEntity<LoginSuccessEntity.PayLoadBean>> quickLogin();

    /**
     * 获取手机验证码
     *
     * @return
     */
    @FormUrlEncoded
    @POST("authsms")
    Observable<BaseEntity<SmsCodeEntity.PayloadBean>> getSmsCode(@FieldMap Map<String, String> map);


    /**
     * 重新登录并重定向
     *
     * @param url
     * @return
     */
    @GET
    Observable<ResponseBody> loginsApi(@Url String url);

    @POST("cuclinic/doctor/list")
    Observable<BaseEntity<List<AuthorListEntity.DataBean>>> authorListApi(@Body RequestBody body);

    @GET("app/consult/specialist/list/{size}")
    Observable<BaseEntity<List<NewConsultListBean.PayLoadBean.SpecialistConsultsBean>>> getList(@Path("size") String size);

    /**
     * 版本更新检测
     *
     * @return
     */
    @GET("app/upgrade/applog/0")
    Observable<BaseEntity<VersionEntity.PayLoadBean>> checkVersion();

    /**
     * 获取首页Banner图
     *
     * @return
     */
    @GET("app/content/advert/banner")
    Observable<BaseEntity<BannerEntity.PayLoadBean>> getBanner();

    /**
     * 获取首页健康资讯标签
     *
     * @param start
     * @param end
     * @return
     */
    @GET("app/tag/list/healthLecture/0/{start}-{end}")
    Observable<BaseEntity<TagListEntity.PayLoadBean>> getTagList(@Path("start") String start, @Path("end") String end);

    /**
     * 获取首页推荐医生
     *
     * @param body
     * @return
     */
    @POST("cuclinic/operaterposition/list")
    Observable<BaseEntity<RecDoctorListEntity.DataBean>> getRecDoctorList(@Body RequestBody body);

    /**
     * 获取首页病历统计个数
     *
     * @return
     */
    @GET("appoint/count/list")
    Observable<BaseEntity<CaseCountsEntity.PayLoadBean>> getCaseCounts();

    /**
     * 获取用户上传病历记录
     *
     * @return
     */
    @GET("app/illness/user/all/list")
    Observable<BaseEntity<NewCaseListEntity.PayLoadBean>> getUserCaseList();

    /**
     * 获取健康资讯数据
     *
     * @param tagId
     * @param params
     * @return
     */
    @GET("app/tag/article/list/healthLecture/{tagId}/{params}")
    Observable<BaseEntity<HealthEntity.PayLoadBean>> getHealthList(@Path("tagId") String tagId, @Path("params") String params);


    /**
     * 获取科室(包含疾病)v2.0
     */
    @POST("cuclinic/searchdoctorlog/areaanddepartment")
    Observable<BaseEntity<DepatmentWrapperEntity.Depatment>> findDepartMent(@Body RequestBody requestBody);


    /**
     * 获取医生列表
     */
    @POST("cuclinic/searchdoctorlog/listbycondition")
    Observable<BaseEntity<DoctorWrapperEntity.DoctorListEntity>> findDoctorList(@Body RequestBody requestBody);


    /**
     * 获取地区
     */
    @POST("cuclinic/searchdoctorlog/areaanddepartment")
    Observable<BaseEntity<AreaWrapperEntity.DataBean>> findArea(@Body RequestBody requestBody);


    /**
     * 获取提示内容
     */
    @POST("cuclinic/searchdoctorlog/findKeywordByInput")
    Observable<BaseEntity<List<String>>> findReleseContent(@Body RequestBody requestBody);


    /**
     * 获取待筛选的科室地区信息
     */
    @POST("cuclinic/searchdoctorlog/areaanddepartment")
    Observable<BaseEntity<DepatmentAndAreaEntity.DataEntity>> findDeapatmentAndArea(@Body RequestBody requestBody);

    /**
     * 获取用户个人信息
     *
     * @return
     */
    @GET("app/info/userinfo/0")
    Observable<BaseEntity<UserEntity.PayLoadBean>> getUserInfo();


    /**
     * 远程问诊医生列表
     *
     * @return
     */
    @GET("app/doctor/after/hospital?hospitalId=5")
    Observable<BaseEntity<RemoteListEntity.PayLoadBean>> getRemoteList();

    /**
     * 远程问诊自动填充
     *
     * @return
     */
    @POST("cuclinic/autofill/remote")
    Observable<BaseEntity<RemoteAutoFillEntity.DataBean>> autoFillData(@Body RequestBody body);

    /**
     * 获取搜索记录
     */
    @POST("cuclinic/searchdoctorlog/recordlist")
    Observable<BaseEntity<ArrayList<SearchHistoryItem>>> findHistoryById(@Body RequestBody body);

    /**
     * 删除单条的历史记录
     */
    @POST("cuclinic/searchdoctorlog/recorddelete")
    Observable<BaseEntity<Object>> deleteSingleHistoryById(@Body RequestBody body);

    /**
     * 删除所有的历史记录
     */
    @POST("cuclinic/searchdoctorlog/recorddelete")
    Observable<BaseEntity<Object>> deleteAllHistory(@Body RequestBody body);

    /**
     * 搜索提示
     */
    @POST("cuclinic/searchdoctorlog/findKeywordByInput")
    Observable<BaseEntity<List<String>>> findKeyWordByInput(@Body RequestBody requestBody);

    /**
     * 医生详情
     *
     * @param hashMap 参数集合
     */
    @FormUrlEncoded
    @POST("appoint/doctor/doctordetail")
    Observable<BaseEntity<DoctorEntity.PayLoadEntity>> getDoctorDetails(@FieldMap HashMap<String, String> hashMap);

    /**
     * 获取医生团队信息
     */
    @POST("cuclinic/doctor/institutions")
    Observable<BaseEntity<List<TeamEntity.DataEntity>>> getDoctorDetails(@Body RequestBody requestBody);


    /**
     * 获取团队详情
     */
    @FormUrlEncoded
    @POST("appoint/institution/select/new/institutiondetails/")
    Observable<BaseEntity<DoctorTeamEntity>> getDoctorTeamInfo(@FieldMap HashMap<String, String> hashMap);


    /**
     * 获取个人档案
     */
    @GET("app/health/detail")
    Observable<BaseEntity<HealthRecordEntity>> findHealthRecord();

    /**
     * 获取后台已知疾病类型
     */
    @POST("cuclinic/doctor/diseaselist")
    Observable<BaseEntity<ChooseDisesTypeEntity>> findDisesType(@Body RequestBody requestBody);

    /**
     * 医生下的疾病类型列表
     *
     * @return
     */
    @POST("cuclinic/doctor/diseaselist")
    Observable<BaseEntity<DiseaseEntity.DataBean>> diseaseList(@Body RequestBody body);


    /**
     * 获取患者上次咨询的内容
     */
    @POST("cuclinic/autofill/specialistconsult")
    Observable<BaseEntity<LastConsultEntity>> findLastConslutContent(@Body RequestBody requestBody);

    /**
     * 健康档案是否完善
     */
    @GET("app/health/whole")
    Observable<BaseEntity<RecordEntity.PayLoadBean>> isperfect();

    /**
     * 该医生下是否有远程提交
     */
    @GET("app/remote/uncancel/remote/{doctorId}")
    Observable<BaseEntity<RemoteRepeatEntity.PayLoadBean>> isRepeat(@Path("doctorId") int doctorId);

    /**
     * 远程提交
     */
    @POST("app/remote/submit")
    Observable<BaseEntity<RemoteRepeatEntity.PayLoadBean>> createRemote(@Body RequestBody body);

    /**
     * 医生是否授权弹窗
     */
    @POST("cuclinic/customeranddoctor/top")
    Observable<BaseEntity<String>> empower(@Body RequestBody body);

    /**
     * 医生查看病历授权更新
     */
    @POST("cuclinic/customeranddoctor/update")
    Observable<BaseEntity<String>> empowerUpdate(@Body RequestBody body);
    /**
     * 远程列表
     */
    @GET("app/remote/after/list/{totals}")
    Observable<BaseEntity<LongRangeListEntity.PayLoadBean>> remoteList(@Path("totals") String totals,@QueryMap Map<String,String> map);
    /**
     * 远程详情
     *
     */
    @GET("app/remote/detail/{remoteId}/v2")
    Observable<BaseEntity<RemoteDetailsEntity.PayLoadBean>> remoteDetail(@Path("remoteId") String remoteId);
    /**
     * 远程取消
     *
     */
    @GET("app/remote/cancel/{remoteId}/v2")
    Observable<BaseEntity<RemoteRepeatEntity.PayLoadBean>> remoteCancel(@Path("remoteId") String remoteId);
  /**
     * 远程补充资料
     *
     */
    @POST("app/remote/supplement/{remoteId}")
    Observable<BaseEntity<RemoteRepeatEntity.PayLoadBean>> remoteSupply(@Path("remoteId") String remoteId,@Body RequestBody body);
    /**
     * 健康档案联系人
     */
    @GET("app/health/contacts/list/0-9")
    Observable<BaseEntity<HealthRecordEntity.PerProfileBean>>  healthContacts();
    /**
     * 健康档案手术记录
     */
    @GET("app/health/operation/list/0-9")
    Observable<BaseEntity<HealthRecordEntity.PerProfileBean>>  healthOperation();
    /**
     * 我的随访医生列表
     */
    @POST("cuclinic/doctor/sflist")
    Observable<BaseEntity<List<FollowDoctorEntity.DataBean>>> getFollowDoctorList(@Body RequestBody body);
    /**
     * 医生下的随访记录列表
     */
    @POST("cuclinic/userquestionnairehistory/list")
    Observable<BaseEntity<FollowRecordEntity.DataBean>> getFollowRecordList(@Body RequestBody body);
    /**
     * 问诊表上传
     */
    @POST("cuclinic/userquestionnairehistory/update")
    Observable<BaseEntity<FollowUploadEntity.DataBean>> uploadFollowHtml(@Body RequestBody body);

    /**
     * @param startPage 起始页码
     * @param endPage   结束页码
     */
    @GET("app/consult/specialist/list/{startPage}-{endPage}?sortBy=createtime&desc=true")
    Observable<BaseEntity<MyConsultEntity>> findMyConsult(@Path("startPage") int startPage, @Path("endPage") int endPage);


    /**
     * @param consultId 咨询Id
     */
    @GET("app/consult/specialist/detail/{consultId}")
    Observable<BaseEntity<ConsultDetailsEntity>> findConsultDeatails(@Path("consultId") int consultId);

    /**
     * 修改密码前需要调用该接口
     *
     * @return null
     */
    @GET("auth/cu/pwdUpdate")
    Observable<PreRequestEntuty> pwdUpdate();

    /**
     * 修改密码前需要调用该接口
     *
     * @return null
     */
    @FormUrlEncoded
    @POST("auth/cu/pwdUpdate")
    Observable<PreRequestEntuty> pwdUpdateNow(@FieldMap HashMap<String, String> hashMap);


    /**
     * 上传反馈
     * @param hashMap
     * @return
     */
    @FormUrlEncoded
    @POST("/app/feedback/upload")
    Observable<FeedBackEntity> upFeedContent(@FieldMap HashMap<String, String> hashMap);


    /**
     *
     * 查询我的医生
     * */
    @POST("cuclinic/doctor/list/")
    Observable<BaseEntity<List<MyDoctorEntity.DataBean>>>getMyDocotor(@Body RequestBody requestBody);


    /**
     * 设置医生权限
     * @param requestBody
     * @return
     */
    @POST("cuclinic/customeranddoctor/update")
    Observable<BaseEntity<Object>> allowedPermission(@Body RequestBody requestBody);


    /**
     *
     * 更新个人信息
     * @param requestBody
     * @return
     */
    @POST("app/info/update/userinfo")
    Observable<BaseEntity<SimpleReponseEntity.PayLoadBean>>updateUserInfo(@Body RequestBody requestBody);


    /**
     * 上传图片
     * ynfileserver
     */
    @Multipart
    @POST("testimg/upload")
    Observable<BaseEntity<String>> uploadMd5(@Part MultipartBody.Part info);

}